package com.yan.qing.bootoss.service;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Assert;
import com.yan.qing.bootoss.pojo.AliOssInstance;
import com.yan.qing.bootoss.pojo.AliOssProperties;
import com.yan.qing.bootoss.util.ExcelUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.LinkedHashMap;
import java.util.List;

/**
 */
@Slf4j
@Component
public class AliOssService {

   // @Resource
    AliOssProperties aliOssProperties;

    public AliOssInstance exportExcel(String filePath, LinkedHashMap<String, String> map, List<?> data) {
        Assert.isTrue(CollectionUtil.isNotEmpty(map), "导出列标题为空");
        Assert.isTrue(CollectionUtil.isNotEmpty(data), "导出数据为空");
        return ExcelUtil.toAliOss(filePath, map, data, aliOssProperties);
    }

}
